home *** CD-ROM | disk | FTP | other *** search
/ Programmer Plus 2007 / Programmer-Plus-2007.iso / Programming / XML Utilities / Professional Programmer XSL IDE / Xselerator25.msi / Data.Cab / F19714_RadioPull1.xsl < prev    next >
Encoding:
Extensible Markup Language  |  2001-10-04  |  2.1 KB  |  57 lines

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <!-- ===========================================================
  3.   Category:       HTML
  4.   Sub-category:   RadioButtons
  5.   Author:         David Silverlight
  6.                   HeadGeek@xmlpitstop.com
  7.   Created:        2001-05-16
  8.   Description:-
  9.     This stylsheet demonstrates how to create radio buttons from
  10.     an xml document.  Also note that we are using the Pull
  11.     method to extract data from our xml document.  The pull
  12.     method is an approach where the use of templates is
  13.     minimized and data is  accessed by 'pulling' it from our xml
  14.     document
  15. ================================================================ -->
  16. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  17.   <xsl:output method="html" />
  18.  
  19.   <xsl:template match="/">
  20.     <html>
  21.       <head>
  22.         <style type="text/css">
  23.         H1 {COLOR: red; FONT-FAMILY: Arial; FONT-SIZE: 14pt;}
  24.         H2 {COLOR: darkblue; FONT-FAMILY: Arial; FONT-SIZE: 12pt;}
  25.         .head {COLOR: darkblue; FONT-FAMILY: Arial; FONT-SIZE: 14pt;}
  26.         .subhead {COLOR: darkblue; FONT-FAMILY: Arial; FONT-SIZE: 12pt;}
  27.         .text {COLOR: black; FONT-FAMILY: Arial; FONT-SIZE: 12pt;}
  28.         TH {COLOR: white; FONT-FAMILY: Arial; background-color: darkblue;}
  29.         TD {COLOR: darkblue; FONT-FAMILY: Arial}
  30.         TR { background-color: beige; }
  31.         BODY { background-color: beige; }
  32.         </style>
  33.       </head>
  34.       <body>
  35.         <h1>Generating Radio Buttons from XML Data (Pull Method)</h1>
  36.  
  37.         <xsl:for-each select="UserOptions/option">
  38.           <xsl:value-of select="@title" />
  39.  
  40.           <input type="radio">
  41.             <xsl:attribute name="Name">
  42.               <xsl:value-of select="@groupname" />
  43.             </xsl:attribute>
  44.  
  45.             <xsl:attribute name="ID">
  46.               <xsl:value-of select="@groupname" />
  47.             </xsl:attribute>
  48.  
  49.             <xsl:if test="@default = 'true'">
  50.               <xsl:attribute name="checked" />
  51.             </xsl:if>
  52.           </input>
  53.         </xsl:for-each>
  54.       </body>
  55.     </html>
  56.   </xsl:template>
  57. </xsl:stylesheet>